package day15;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

public
class Server {
    //key 用户名  value 客户端socket
    public volatile static Map<String, Socket> map = new ConcurrentHashMap<>();

    public static
    void main(String[] args) throws IOException {
        ServerSocket server = new ServerSocket(9998);
        System.out.println("启动服务器");
        while (true) {
            Socket socket = server.accept();
            System.out.println("有新的客户端连接");
            //线程
            new ServerThead(socket).start();
        }
    }
}
